package com.net.wanjian.networkhospitalmanager.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.net.wanjian.networkhospitalmanager.R;
import com.net.wanjian.networkhospitalmanager.utils.URLDecoderUtil;

import java.util.List;

/**
 * Created by WJ on 2017/8/8.
 */

public class SignTimeItemAdapter extends RecyclerView.Adapter<SignTimeItemAdapter.ViewHoldX> {
    private List<String> mList;
    private Context mContext;

    public SignTimeItemAdapter(Context cxt, List<String> list) {
        this.mContext = cxt;
        this.mList = list;
    }

    @Override
    public ViewHoldX onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(mContext).inflate(R.layout.item_sign_x, parent, false);
        ViewHoldX viewHoldX = new ViewHoldX(inflate);
        return viewHoldX;
    }

    @Override
    public void onBindViewHolder(ViewHoldX holder, int position) {
        holder.tv_sing_on.setText(URLDecoderUtil.getDecoder(mList.get(position)));
    }

    @Override
    public int getItemCount() {
        return mList == null ? 0 : mList.size();
    }

    class ViewHoldX extends RecyclerView.ViewHolder {
        TextView tv_sing_on;

        public ViewHoldX(View itemView) {
            super(itemView);
            tv_sing_on = (TextView) itemView.findViewById(R.id.tv_sing_on);

        }
    }
}
